setDisplayIntent

Deprecated

Display intents are no longer supported.

Set an intent to launch inside of an activity view when displaying this notification. The PendingIntent provided should be for an activity.

Intent displayIntent = new Intent(context, MyDisplayActivity.class);
PendingIntent displayPendingIntent = PendingIntent.getActivity(context,
        0, displayIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new NotificationCompat.Builder(context)
        .extend(new NotificationCompat.WearableExtender()
                .setDisplayIntent(displayPendingIntent)
                .setCustomSizePreset(NotificationCompat.WearableExtender.SIZE_MEDIUM))
.build();

The activity to launch needs to allow embedding, must be exported, and should have an empty task affinity. It is also recommended to use the device default light theme.

Example AndroidManifest.xml entry:

<activity android:name="com.example.MyDisplayActivity"
    android:exported="true"
    android:allowEmbedded="true"
    android:taskAffinity=""
android:theme="@android:style/Theme.DeviceDefault.Light" />

Return

this object for method chaining

Parameters

intent

the PendingIntent for an activity

See also